As a technique for detecting a failure in an encoder, Patent Literature 1 discloses a technique that enables to compare a magnetic pole position estimated from pulse numbers of position detection signals PA and PB and a motor pole number P with actual magnetic-pole position data PU, PV, and PW and determine a failure when differences in the position are out of an acceptable range.